package main

import (
	"suber-exporter/cmd"
	"suber-exporter/controller"
	"suber-exporter/metrics"

	"github.com/gin-gonic/gin"
	"github.com/prometheus/client_golang/prometheus"
	"github.com/prometheus/client_golang/prometheus/promhttp"
)

func main() {
	engine := gin.Default()
	socket := cmd.NewSocket()

	// 注册自定义指标
	prometheus.MustRegister(metrics.MetricsCounter, metrics.GaugeMetric, metrics.HistogramMetric, metrics.SummaryMetric)

	engine.GET("/", controller.GetAppMessage)

	engine.GET("/counter", metrics.Counter)
	engine.POST("/counter", metrics.Counter)

	metrics.Gauge(engine)
	metrics.Histogram()
	metrics.Summary()

	engine.GET("/metrics", gin.WrapH(promhttp.Handler()))

	engine.Run(socket.Host + ":" + socket.Port)
}
